package member.member.action;

import m.common.action.ActionRequest;
import m.common.action.Param;
import m.common.action.RequestMethod;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;
import m.system.exception.MException;
import m.system.util.JSONMessage;
import member.order.model.MemberRecharge;

@ActionRequest(name = "action/member/memberRecharge",description = "订单")
public class MemberRechargeAction extends MemberAction{
    @RequestMethod(description = "我的列表")
    public JSONMessage getMyList() throws Exception {
        ModelQueryList queryList=toQueryList(MemberRecharge.class,"*","inputStore.*","serveUser.realName");
        queryList.addCondition(QueryCondition.eq("member.oid", getSessionOid()));
        return JSONMessage.success("查询成功").push("page", ModelQueryList.getModelPageInfo(queryList));
    }
    @RequestMethod(description = "获取信息")
    public JSONMessage getInfo(@Param("oid") String oid) throws Exception {
        MemberRecharge model=ModelQueryList.getModel(MemberRecharge.class,oid,"*","member.*","member.level.*",
            "inputUser.realName","inputUser.phoneNum","serveUser.realName","serveUser.phoneNum","confirmUser.realName","confirmUser.phoneNum",
            "order.*");
        if(null==model) throw new MException("充值信息不存在");
        verifyMember(model.getMember());
        return JSONMessage.success("查询成功")
            .push("model",model);
    }
}
